{include file = "styles/header.tpl"}
<script type="text/javascript" src="js/user/index.js"></script>

<div id="content" class="box">
	<h1>Mangage User</h1>
	
	<form method="get" name="frmSearch">
	<fieldset>
		<legend>
			<a href="javascript:setDisplayFillter('hide');" class="smaller" id="fillterHidden">
				Hide
			</a>
			<a href="javascript:setDisplayFillter('display');" class="smaller" id="fillterDisplay" style="display:none;">
				Display
			</a>
		</legend>
		<div id="fillterContent">

			<label>Country: </label>
			<select name="country">
				<option value="0">Country</option>
				{foreach from=$arrCountry item=country}
				<option value="{$country.id}"{if $intCountryId==$country.id} selected="selected"{/if}>&nbsp;+&nbsp;{$country.name}&nbsp;</option>
				{/foreach}
			</select>
			<label>Team: </label>
			<select name="g">
				<option value="0">Team</option>
				{foreach from=$arrTeam item=team}
				<option value="{$team.id}"{if $intGroupId==$team.id} selected="selected"{/if}>&nbsp;+&nbsp;{$team.name}&nbsp;</option>
				{/foreach}
			</select>

			<label>Email: </label>
			<input name="email" value="{$email}"/>
			
			<input type="hidden" name="page" value="{$intPage}" />
			<input type="hidden" name="li" value="{$intItemOnPerPage}" />
			<input type="submit" value="Search" name="smb" class="bt" />
			<div style="float:right;" >
		
			<a href="{$smarty.const.HOST_ADMIN}/user/add" class="homeButton" >
				<span><strong>Create User</strong></span>
			</a>
			</div>
		</div>
	</fieldset>
	<fieldset >
		
	</form>
	
	<form method="post" action="{$smarty.const.HOST_ADMIN}/user/save" enctype="multipart/form-data" target="ifrmUserData" onsubmit="return doSubmit();">
			<p class="msg error hide" id="null_saledata">File does not exists</p>
			<label>Upload user information: </label><input type="file" name="file" readonly="true" />
			<input type="submit" value="Upload Data" class="bt" />
				<a href="{$smarty.const.HOST_ADMIN}/common/download/?filename=UserInformation.csv&p=/static/templates">Download Template File</a>
		</form>
     </fieldset>

	<iframe name="ifrmUserData" id="ifrmUserData" width="100%" style="display:none"></iframe>
	
	<table width="100%">
		<tr>
		    <th>Country</th>
			<th>Team</th>
			<th>Email</th>
			<th>Firstname</th>
		    <th>Lastname</th>
			<th>CreateDate</th>
			<th>LastLogin</th>
			<th>Status</th>
			<th class="last">Action</th>
		</tr>
		{section name=i loop=$arrResult}
		<tr {if $smarty.section.i.index%2!=0}class="bg"{/if}>
		    <td>
				{foreach from=$arrCountry item=country}
					{if $country.id==$arrResult[i].country}{$country.name}{/if}
				{/foreach}
			</td>
		    <td>
				{foreach from=$arrTeam item=team}
					{if $team.id==$arrResult[i].group_id}{$team.name}{/if}
				{/foreach}
			</td>
			<td>{$arrResult[i].admin_username}</td>
			<td>{$arrResult[i].admin_firstname}</td>
			<td>{$arrResult[i].admin_lastname}</td>
			<td>{$arrResult[i].admin_createdate}</td>
			<td>{$arrResult[i].admin_lastlogin}</td>
			<td align="center">{if $arrResult[i].admin_isactive==1}Active{else}<strong>Inactive</strong>{/if}</td>
			<td align="center">
				<a href="{$smarty.const.HOST_ADMIN}/user/add/?i={$arrResult[i].admin_id}">Edit</a>
			</td>
		</tr>
		{/section}
	</table>
</div>
<div id="currenttab" class="category_create_edit_user" style="display: none;">
{literal}
<script type="text/javascript">
	function doSubmit()
	{
		showWaiting();
		return true;
	}
	
	function update_done()
	{
		alert('The process is done.');
		window.location.href = window.location.href;
		$.unblockUI();
	}
</script>
{/literal}
{include file = "styles/footer.tpl"}